PPCInformSync
PPCInform Receive session requests
#include <PPCToolbox.h> PPC Toolbox
OSErr PPCInform(pb, async);
PPCInformPBPtr pb; Pointer to PPC parameter block
Boolean async; if TRUE, use asynchronous communications
returns Error Code; 0=no error
On entry A0: pointer to a parameter block
D0: selector (3)
On exit D0: result code
Parameter block
Æ 12 ioCompletion long address of a completion routine
¨ 16 ioResult short result code
Æ 38 portRefNum short port reference number of this session
¨ 40 sessRefNum long session reference number of this session
¨ 44 serviceType char service type of this session
Æ 45 autoAccept char if TRUE, session is accepted automatically
Æ 46 portName long pointer to PPCPortRec, may be NIL
Æ 50 locationName long pointer to LocationNameRec, may be NIL
Æ 54 userName long pointer to Str32, may be NIL
¨ 58 userData long application-specific data
¨ 62 requestType char network or local request
You use the PPCInform function to receive session requests. After the
PPCInform function completes (with the autoAccept field set to FALSE), you
must accept or reject the session request using the PPCAccept and
PPCReject functions.
As long as a port has been opened, you can call the PPCInform function at
any time. You can have any number of outstanding PPCInform functions.
If your application calls this function asynchronously, you must specify in
the ioCompletion field either the address of a completion routine or NIL. If
ioCompletion is NIL, you should poll the ioResult field of the
PPC parameter block (from your application's main event loop) to determine
whether the PPC Toolbox has completed the requested operation. A value in
the ioResult field other than 1 indicates that the call is complete. Note that it is
unsafe to poll the ioResult field at interrupt time since the PPC Toolbox may
be in the process of completing a call.
See PPC Toolbox Calling Conventions for detailed information.
If you call the PPCInform function asynchronously, you must not change any
of the fields in the parameter block until the call completes. The
port name, location name, user name, and buffer pointed to by the record of
type PPCInformPBRec are owned by the PPC Toolbox until the call
completes. These objects must not be de allocated or moved in memory while the
call is in progress.
You provide the PPC port identifier in the portRefNum field. A PPCOpen
function returns the port identifier. The sessRefNum field returns a session
identifier.
The serviceType field indicates the service type. For System 7.0+, this field
always returns the ppcServiceRealTime constant.
If you set the autoAccept field to TRUE, session requests are automatically
accepted as they are received. When the PPCInform function completes
execution with a noErr result code and you set the autoAccept field to FALSE,
you need to accept or reject the session.
Warning: If the PPCInform function (with the autoAccept parameter set
to FALSE) returns a noErr result code, you must call either the PPCAccept
function or the PPCReject function. The computer trying to initiate a session
using the StartSecureSession function or the PPCStart function waits
(hangs) until the session attempt is either accepted or rejected, or until an
error occurs.
The portName field must contain NIL or a pointer to a PPC port record. If the
portName field contains NIL, then the name of the PPC port that initiated the
session is not returned. If the portName field points to a
PPC port record, then the PPC port record is filled with the name of the PPC
port that initiated the session when the PPCInform function completes.
The locationName field must contain NIL or a pointer to a
location name record. If the locationName field contains NIL, then the location
of the PPC port that initiated the session is not returned. If the locationName
field points to a location name record, then the location name record is filled
with the location of the PPC port that initiated the session when the
PPCInform function completes. If the locationKindSelector field of the
location name record returned is ppcNoLocation, then the location is the local
machine. If the locationKindSelector field of the location name record returned
is ppcNBPLocation, then the location is a remote machine designated by the
nbpEntity field of the location name record.
The userName field must contain NIL or a pointer to a 32-byte character
string. If the userName field contains NIL, then the user name string is not
returned. If the userName field points to a 32-byte character string, then the
32-byte character string is filled with the name of the user making the session
request (if authenticated) when the PPCInform function completes.
When the PPCInform function completes, the userData field contains the
user data provided by the application making the session request. This field is
transparent to the PPC Toolbox. The application can send any data in this
field.
When the PPCInform function completes, the requestType field contains
either ppcRemoteOrigin or ppcLocalOrigin, depending on whether the session
request is initiated by a computer across the network or by a port on the same
computer.
You should execute the PPCInform function asynchronously.
Returns: an operating system Error Code.
noErr (0) No error
notInitErr (-900) PPC Toolbox has not been initialized yet
noPortErr (-903) Unable to open port or bad port reference number
noGlobalsErr (-904) System unable to allocate memory, critical error
portClosedErr (-916) The port was closed